---
title: Spring Boot Integration to Write Excel
description: Spring Boot Integration to Write Excel
---

## Overview
In a Spring Boot project, you can generate Excel files through HTTP interfaces and provide download functionality, making it convenient to use FastExcel in a web environment.

### Spring Controller Example

### Overview
Generate Excel files through HTTP interfaces and provide download functionality.

#### Sample Code
```java
@GetMapping("download")
public void download(HttpServletResponse response) throws IOException {
    response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
    response.setCharacterEncoding("utf-8");
    String fileName = URLEncoder.encode("Test", "UTF-8").replaceAll("\\+", "%20");
    response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx");

    FastExcel.write(response.getOutputStream(), DemoData.class)
        .sheet("Template")
        .doWrite(data());
}
```